
<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="Cache-Control" content="no-siteapp"/>
  <meta name="renderer" content="webkit" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <meta name="keywords" content="Editor.md,editor,Markdown Editor,Markdown,编辑器,Markdown编辑器,Markdown在线编辑器,在线编辑器,开源编辑器,开源Markdown编辑器" />
  <meta name="description" content="Editor.md: a simple online markdown editor. 开源在线 Markdown 编辑器" />
  <title>Auto height - Editor.md examples</title>
  <link rel="stylesheet" href="/editormd/css/style.css" />
  <link rel="stylesheet" href="/editormd/css/editormd.css" />
  <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />

</head>
<body>
<div id="layout">
  <div class="btns">
    <button id="append-btn">保存并关闭窗口</button>
  </div>
  <div id="test-editormd">
                <textarea style="display:none;" id="textarea">
</textarea>
  </div>
</div>
<!--<script src="/editormd/js/jquery.min.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="/editormd/editormd.js"></script>
<script type="text/javascript">
  var testEditor;

  $(function() {
    testEditor = editormd("test-editormd", {
      width           : "90%",
      height:620,
      // autoHeight      : true,
      path            : "/editormd/lib/",
      htmlDecode      : "style,script,iframe",
      tex             : true,
      emoji           : true,
      taskList        : true,
      flowChart       : true,
      sequenceDiagram : true,
      // 图片上传
      imageUpload    : true,
      imageFormats   : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
      imageUploadURL : "/upload",
    });

    $("#append-btn").click(function(){
      // $.get("./test.md", function(md){
      //   testEditor.appendMarkdown(md);
      // });
      window.opener.document.getElementById("content").value = document.getElementById("textarea").value;
      window.close();
    });
  });
</script>
<style>#cnzz_stat_icon_1254310986{display: none;}</style>
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1254310986'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/stat.php%3Fid%3D1254310986%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script>

<script>
  var t = document.getElementById("textarea");
  t.value = window.opener.document.getElementById("content").value;
  // console.log(window.opener.document.getElementById("content").value);
</script>
</body>
</html>